package 天梯赛;

import java.util.Scanner;

public class 机工士姆斯塔迪奥 {
    public static void main(String[] args) {
        int count=0;
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();//行
        int m=scanner.nextInt();//列
        int q=scanner.nextInt();//选择的行和列
        int [][] arr=new int[q][2];
        if (m*n>=1 && m*n<=100000 && q>=0 && q<=1000) {
            for (int i = 0; i < q; i++) {
                for (int j = 0; j < 2; j++) {
                    arr[i][j] = scanner.nextInt();
                }
            }
            int ling = 0;
            int yi = 0;
            for (int i = 0; i < q; i++) {
                if (arr[i][0] == 0) {
                    count += n;
                    ling++;
                }
                if (arr[i][0] == 1) {
                    count += m;
                    yi++;
                }
            }
            count -= ling * yi;
            System.out.println(m * n - count);
        }
    }
}
